class CreatePagos < ActiveRecord::Migration
  def self.up

    #formas de pago
    create_table :formas do |t|
      t.column :nombre, :string, :limit=>50, :null=>false
      t.column :cociente, :float, :null=>false
    end
    
    create_table :pagos do |t|
      t.column :instuctor_id, :integer, :null=>false
      t.column :persona_id, :integer, :null=>false
      t.column :monto, :float, :null=>false
      t.column :desc, :string, :limit=>100
      t.column :forma_id, :integer, :null=>false
    end
    
    add_index :pagos, :persona_id
    add_index :pagos, :forma_id
    
    create_table :pagos_tickets do |t|
      t.column :ticket_id, :integer, :null=>false
      t.column :pago_id, :integer, :null=>false
    end
    
    add_index :pagos_tickets, [:ticket_id, :pago_id]
  end

  def self.down
    drop_table :pagos
    drop_table :formas
    drop_table :pagos_tickets
  end
end
